package join;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class PersonAddreMain {
    public static void main(String[] args) throws Exception {

        args = new String[]{"F:\\A\\join\\", "F:\\A\\out_Andy1"};

        Configuration conf = new Configuration();
        Job job = Job.getInstance(conf);
        job.setJarByClass(PersonAddreMain.class);

        //设置自定义的group
        job.setGroupingComparatorClass(PKFKCompartor.class);

        job.setMapperClass(PersonAddreMap.class);
        job.setMapOutputKeyClass(BeanKey.class);
        job.setMapOutputValueClass(Bean.class);

        job.setReducerClass(PersonAddreReduce.class);
        job.setOutputKeyClass(NullWritable.class);
        job.setOutputValueClass(Text.class);

        FileInputFormat.addInputPath(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));
        job.waitForCompletion(true);
    }
}

